package com.qf.team2.netdisc.common.pojo.qo;

import java.math.BigDecimal;
import java.util.Objects;

/**
 * 支付宝订单参数实体:
 *
 * @author Simon_Wong
 * @since 2021/5/25 11:20
 */
@SuppressWarnings("AlibabaClassNamingShouldBeCamel")
public class AlipayOrderQO {

    /**
     * 订单编号
     */
    private String outTradeNo;

    /**
     * 商品名
     */
    private String subject;

    /**
     * 订单金额
     */
    private BigDecimal totalAmount;

    /**
     * 商品描述
     */
    private String body;

    public AlipayOrderQO() {
    }

    public AlipayOrderQO(String outTradeNo, String subject, BigDecimal totalAmount, String body) {
        this.outTradeNo = outTradeNo;
        this.subject = subject;
        this.totalAmount = totalAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
        this.body = body;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getSubject() {
      return subject;
   }

   public void setSubject(String subject) {
      this.subject = subject;
   }

   public BigDecimal getTotalAmount() {
      return totalAmount;
   }

   public void setTotalAmount(BigDecimal totalAmount) {
       this.totalAmount = totalAmount.setScale(2, BigDecimal.ROUND_HALF_UP);
   }

   public String getBody() {
      return body;
   }

   public void setBody(String body) {
      this.body = body;
   }

   @Override
   public boolean equals(Object o) {
      if (this == o) {
         return true;
      }
      if (o == null || getClass() != o.getClass()) {
         return false;
      }
      AlipayOrderQO that = (AlipayOrderQO) o;
      return outTradeNo.equals(that.outTradeNo) && subject.equals(that.subject) && totalAmount
              .equals(that.totalAmount) && body.equals(that.body);
   }

   @Override
   public int hashCode() {
      return Objects.hash(outTradeNo, subject, totalAmount, body);
   }

   @Override
   public String toString() {
      return "AlipayOrderQO{" +
              "outTradeNo='" + outTradeNo + '\'' +
              ", subject='" + subject + '\'' +
              ", totalAmount='" + totalAmount + '\'' +
              ", body='" + body + '\'' +
              '}';
   }
}
